<template>
  <div class="container">商品详情页面</div>
  <button @click="onClick">去子页面</button>
</template>

<script>
import router from '@/router'
import store from '@/store'
//
export default {
  name: 'Detail',
  components: {},
  setup (props, context) {
    // 路由上的参数获取
    console.log(router.currentRoute.value.params)
    function onClick () {
      // context.emit('change-view', {
      //   name: 'SubDetail',
      //   params: {}
      // })
      store.commit('changeView', {
        name: 'SubDetail',
        params: {}
      })
    }
    return {
      onClick
    }
  }
}
</script>

<style>
/* .container {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: #ffff;
} */
</style>
